package com.alexander.cloundexplorer.bean.response;

import com.alexander.cloundexplorer.bean.DirectoryInfo;

import java.io.Serializable;

public class FileAndDirectoryInfoResponse implements Serializable
{
    private String id;
    private String userId;
    private String createTime;
    private String name;
    private String isFile;

    private String fileSize;
    private String postfixType;
    private String postfix;
    private String filePath;
    private String nameSameNo;

    private String fatherAbsolutePath;
    private String modifyTime;
    private String fileMD5;
    private String delTime;
    private String isDel;
    private String fatherId;

    public FileAndDirectoryInfoResponse()
    {
    }

    public String getIsFile()
    {
        return isFile;
    }

    public void setIsFile(String isFile)
    {
        this.isFile = isFile;
    }

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getUserId()
    {
        return userId;
    }

    public void setUserId(String userId)
    {
        this.userId = userId;
    }

    public String getCreateTime()
    {
        return createTime;
    }

    public void setCreateTime(String createTime)
    {
        this.createTime = createTime;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getFileSize()
    {
        return fileSize;
    }

    public void setFileSize(String fileSize)
    {
        this.fileSize = fileSize;
    }

    public String getPostfixType()
    {
        return postfixType;
    }

    public void setPostfixType(String postfixType)
    {
        this.postfixType = postfixType;
    }

    public String getPostfix()
    {
        return postfix;
    }

    public void setPostfix(String postfix)
    {
        this.postfix = postfix;
    }

    public String getFilePath()
    {
        return filePath;
    }

    public void setFilePath(String filePath)
    {
        this.filePath = filePath;
    }

    public String getNameSameNo()
    {
        return nameSameNo;
    }

    public void setNameSameNo(String nameSameNo)
    {
        this.nameSameNo = nameSameNo;
    }

    public String getFatherAbsolutePath()
    {
        return fatherAbsolutePath;
    }

    public void setFatherAbsolutePath(String fatherAbsolutePath)
    {
        this.fatherAbsolutePath = fatherAbsolutePath;
    }

    public String getModifyTime()
    {
        return modifyTime;
    }

    public void setModifyTime(String modifyTime)
    {
        this.modifyTime = modifyTime;
    }

    public String getFileMD5()
    {
        return fileMD5;
    }

    public void setFileMD5(String fileMD5)
    {
        this.fileMD5 = fileMD5;
    }

    public String getDelTime()
    {
        return delTime;
    }

    public void setDelTime(String delTime)
    {
        this.delTime = delTime;
    }

    public String getIsDel()
    {
        return isDel;
    }

    public void setIsDel(String isDel)
    {
        this.isDel = isDel;
    }

    public String getFatherId()
    {
        return fatherId;
    }

    public void setFatherId(String fatherId)
    {
        this.fatherId = fatherId;
    }

    /**获取文件名称
     * 文件和文件夹的获取方式不同
     * */
    public String getStringName()
    {
        if(isFile.equals("1"))
        {
            return name.concat(nameSameNo).concat(postfix);
        }
        else
        {
            return name;
        }
    }

    /**
     * 如果是文件，获取文件信息
     * */
    public FileInfoResponse getFileInfo()
    {
        FileInfoResponse fileInfoResponse = null;
        if(isFile.equals("1"))
        {
            fileInfoResponse = new FileInfoResponse();
            fileInfoResponse.setId(Integer.valueOf(id));
            fileInfoResponse.setFatherDirectoryId(fatherId);
            fileInfoResponse.setFile_postfix(postfix);
            fileInfoResponse.setFileDel(isDel);
            fileInfoResponse.setFileDelTime(delTime);
            fileInfoResponse.setFileMD5(fileMD5);
            fileInfoResponse.setFileModifyTime(modifyTime);
            fileInfoResponse.setFileName(name);
            fileInfoResponse.setFileNameSameNo(nameSameNo);
            fileInfoResponse.setFilePostfixType(postfixType);
            fileInfoResponse.setFileSize(fileSize);
            fileInfoResponse.setFileUploadTime(createTime);
            fileInfoResponse.setFileUserid(userId);
        }
        return fileInfoResponse;
    }

    /**
     * 如果是文件夹，获取文件夹信息
     * */
    public DirectoryInfo getDirectoryInfo()
    {
        DirectoryInfo directoryInfo = null;
        if(isFile.equals("0"))
        {
            directoryInfo = new DirectoryInfo();
            directoryInfo.setId(Integer.valueOf(id));
            directoryInfo.setUserid(userId);
            directoryInfo.setDirectoryName(name);
            directoryInfo.setFatherID(fatherId);
            directoryInfo.setCreateTime(createTime);
            directoryInfo.setModifyTime(modifyTime);
            directoryInfo.setDelTime(delTime);
            directoryInfo.setIsDel(isDel);
        }
        return directoryInfo;
    }
}
